Skip to content

OCI Generative AI Integration for LangChain#2925

Merged
Mason Daugherty (mdrxy) merged 14 commits intolangchain-ai:mainfrom
fede-kamel:feature/oci-docs-overhaul
Mar 5, 2026
Merged

OCI Generative AI Integration for LangChain#2925
Mason Daugherty (mdrxy) merged 14 commits intolangchain-ai:mainfrom
fede-kamel:feature/oci-docs-overhaul

Conversation

@fede-kamel
Copy link
Copy Markdown
Contributor

@fede-kamel Federico Kamelhar (fede-kamel) commented Mar 4, 2026

What's this about

OCI Generative AI Integration for LangChain - comprehensive documentation for the langchain-oci package covering all authentication methods, features, and capabilities.

What changed

Updated the three main OCI docs pages:

providers/oci.mdx - Updated the provider overview with proper auth examples for all four methods (API key, security token, instance principal, resource principal), documented features like vision models and AI agents, and added a section on OCI Data Science deployments.

chat/oci_generative_ai.mdx - Brought the documentation up to the same format as other provider integrations (like Bedrock), added the feature tables, and documented tool calling, structured output, vision capabilities, and async operations. Also covered the Gemini models that can handle PDFs and video.

text_embedding/oci_generative_ai.mdx - Updated embeddings docs to cover both text and image embeddings. Added examples for cross-modal search with the multimodal Cohere models.

Coverage

The docs now cover:

  • All four OCI authentication methods
  • Tool calling including the parallel execution feature in Llama 4+ models
  • Structured output with function calling, json mode, and json schema methods
  • Vision support across Meta Llama, Gemini, Grok, and Cohere models
  • Multimodal capabilities (images, PDFs, video, audio with Gemini)
  • Text and image embeddings
  • Async operations and streaming
  • RAG patterns with vector stores

@github-actions github-actions bot added external User is not a member of langchain-ai langchain For docs changes to LangChain oss python For content related to the Python version of LangChain projects labels Mar 4, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 4, 2026

❌ Import check failed

This PR contains imports from langchain_core that should be imported from langchain instead.

Detailed issues
Analyzing diff for import issues...
 Found 8 import issues:

File: src/oss/python/integrations/chat/oci_generative_ai.mdx
Line: 153
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage, AIMessage
Suggested: from langchain.messages import HumanMessage, AIMessage
--------------------------------------------------------------------------------
File: src/oss/python/integrations/chat/oci_generative_ai.mdx
Line: 218
Issue: Import from langchain.tools instead of langchain_core.tools
Current:   from langchain_core.tools import tool
Suggested: from langchain.tools import tool
--------------------------------------------------------------------------------
File: src/oss/python/integrations/chat/oci_generative_ai.mdx
Line: 325
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage
Suggested: from langchain.messages import HumanMessage
--------------------------------------------------------------------------------
File: src/oss/python/integrations/chat/oci_generative_ai.mdx
Line: 384
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage
Suggested: from langchain.messages import HumanMessage
--------------------------------------------------------------------------------
File: src/oss/python/integrations/providers/oci.mdx
Line: 166
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage
Suggested: from langchain.messages import HumanMessage
--------------------------------------------------------------------------------
File: src/oss/python/integrations/providers/oci.mdx
Line: 189
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage
Suggested: from langchain.messages import HumanMessage
--------------------------------------------------------------------------------
File: src/oss/python/integrations/providers/oci.mdx
Line: 209
Issue: Import from langchain.tools instead of langchain_core.tools
Current:   from langchain_core.tools import tool
Suggested: from langchain.tools import tool
--------------------------------------------------------------------------------
File: src/oss/python/integrations/providers/oci.mdx
Line: 225
Issue: Import from langchain.messages instead of langchain_core.messages
Current:   from langchain_core.messages import HumanMessage
Suggested: from langchain.messages import HumanMessage
--------------------------------------------------------------------------------

 Found 8 import issues that need to be fixed.

Why this is a problem

The langchain package re-exports many modules and classes from langchain_core. When possible, imports should use langchain instead of langchain_core for:

  • Better user experience (single import source)
  • Consistency across documentation
  • Reduced cognitive load for users

How to fix

Replace the imports as suggested above. For example:

  • from langchain_core.messages import HumanMessage
  • from langchain.messages import HumanMessage

🤖 Automated check

This check is based on the latest analysis of langchain re-exports from langchain_core.

@fede-kamel Federico Kamelhar (fede-kamel) marked this pull request as draft March 4, 2026 20:58
Brought the OCI docs up to date with the current langchain-oci package.
The old docs were still referencing langchain-community and missing
most of the newer features.

Main updates:
- Provider overview now covers all auth methods and model types
- Chat integration docs match the standard template with feature tables
- Added vision, tool calling, structured output examples
- Embeddings docs now cover image embeddings and cross-modal search
- Updated all examples to use langchain-oci package

Should bring OCI docs in line with other major provider integrations.
Changed imports to use langchain package instead of langchain_core
for better user experience and consistency.
Simplified all three docs to be more teaching-oriented:
- Removed redundant setup and auth examples
- Consolidated similar examples
- Made tool calling explain WHY not just HOW
- Simplified multimodal sections
- Removed unnecessary model configuration details
- Streamlined embeddings to focus on core concepts

Focused on progressive learning without repetition.
Comment thread src/oss/python/integrations/chat/oci_generative_ai.mdx Outdated
Comment thread src/oss/python/integrations/chat/oci_generative_ai.mdx Outdated
Comment thread src/oss/python/integrations/chat/oci_generative_ai.mdx Outdated
Comment thread src/oss/python/integrations/text_embedding/oci_generative_ai.mdx Outdated
Comment thread src/oss/python/integrations/text_embedding/oci_generative_ai.mdx Outdated
Updated all code examples across provider overview, chat, and embeddings
documentation to use realistic production use cases instead of simple demos:

- Tool calling: Analytics queries, stock prices (was weather API)
- Structured output: Support ticket parsing (was person extraction)
- Vision: Architecture diagrams, chart data extraction (was generic images)
- Multimodal: Contract analysis, meeting transcription (was simple summaries)
- Embeddings: Code documentation search, technical diagrams (was simple text)
- AI Agents: Infrastructure monitoring (was search tutorials)

All examples now demonstrate real engineering scenarios: security analysis,
compliance auditing, log parsing, data extraction, and automation pipelines.
Created complete test suite validating all code examples from OCI documentation:
- 17/18 tests passing (1 skipped - FAISS dependency)
- Tests validate chat models, embeddings, vision, multimodal, and AI agents
- All examples are engineering-focused and production-ready
- Tests use real OCI services with proper authentication
- Includes conftest fixtures, test runner script, and comprehensive README

Test coverage:
- Chat Models: Basic invocation, streaming, async, tool calling, structured output
- Embeddings: Text/image embeddings, RAG integration
- Provider Features: Authentication, vision, Gemini multimodal, AI agents

All documentation examples are now validated against real OCI GenAI services.
@github-actions github-actions bot added the tests label Mar 4, 2026
Comment thread tests/integration_tests/oci/__init__.py Outdated
- Add backticks around class name in API Reference section (ChatOCIGenAI)
- Add backticks around class name in Related links (ChatOCIGenAI)
- Improve consistency with LangChain documentation standards

Per feedback from @mdrxy on PR langchain-ai#2925
- Add backticks around class names in integration tables
- Update API reference URLs to use reference.langchain.com/python/langchain-oci
- Add backticks around OCIGenAIEmbeddings in API Reference section
- Use package-level API reference (matches Bedrock pattern)

Addresses all inline comments from @mdrxy in PR langchain-ai#2925
@fede-kamel Federico Kamelhar (fede-kamel) changed the title Comprehensive OCI Generative AI documentation overhaul OCI Generative AI Integration for LangChain Mar 4, 2026
The langchain-oci package does not have published API docs on reference.langchain.com yet. Updated all API reference links to point to the GitHub repository instead.
All three documents now use 'OCI Generative AI Integration for LangChain' as the title for consistent branding, rather than focusing on individual class names like ChatOCIGenAI.
Tests have been moved to langchain-oracle repository as requested by reviewer. The docs repo should not contain integration tests for external packages.
@github-actions github-actions bot removed the tests label Mar 5, 2026
@mdrxy Mason Daugherty (mdrxy) merged commit cc758ce into langchain-ai:main Mar 5, 2026
11 of 12 checks passed
Mason Daugherty (mdrxy) pushed a commit that referenced this pull request Mar 5, 2026
## Summary

Follow-up improvements to OCI Generative AI documentation (#2925) based
on testing this morning. Apologies for the separate PR - I was working
on these improvements when the original was merged.

**Changes:**

1. **Add example outputs** - Show actual model responses so developers
know what to expect
2. **Complete tool calling flow** - Added full `ToolMessage` execution
loop (was missing)
3. **Fix Gemini PDF format** - Changed `{"type": "media", ...}` to
correct `{"type": "document_url", ...}` format
4. **Simplify examples** - Use strings/tuples where `HumanMessage` isn't
required:
- `llm.invoke("question")` instead of `llm.invoke([HumanMessage(...)])`
   - `("user", "..."), ("assistant", "...")` tuples for multi-turn

## Testing

All 13 integration tests pass against real OCI GenAI services:
- Basic invocation, multi-turn, streaming, async
- Tool calling with complete execution loop
- Structured output with Pydantic
- Vision (Llama 3.2 90B)
- Gemini PDF processing
- Text & image embeddings (Cohere)
- RAG with FAISS
- AI Agent (`create_oci_agent`)

## Files Changed

- `src/oss/python/integrations/chat/oci_generative_ai.mdx`
- `src/oss/python/integrations/providers/oci.mdx`
- `src/oss/python/integrations/text_embedding/oci_generative_ai.mdx`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external User is not a member of langchain-ai langchain For docs changes to LangChain oss python For content related to the Python version of LangChain projects

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants